/*
 * Copyright 1998-2011 by SLIB,
 * 70 rue Villette, 69003 Lyon, France
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of SLIB. (&quot;Confidential Information&quot;).  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with SLIB.
 */
package com.petot.claude.gwt.example.client.place;

import com.google.gwt.activity.shared.FilteredActivityMapper;
import com.google.gwt.place.shared.Place;

/**
 * <code>PlaceToNavigationPlace</code>
 * Convertit une {@link Place} en une {@link NavigationPlace}.
 *
 * @version $Revision: 6 $ $Date: 2012-02-22 10:46:26 +0000 (Wed, 22 Feb 2012) $
 * @author petotcl, $Author: claude.petot@gmail.com $
 */
public class PlaceToNavigationPlace implements FilteredActivityMapper.Filter {

    /**
     * Required by {@link FilteredActivityMapper.Filter}, calls
     * {@link #MockupPlaceFor()}.
     */
    @Override
    public Place filter( final Place place ) {
        return navigationPlaceFor( place );
    }

    /**
     * @param place a place to process
     * @return an appropriate MockupPlace, or null if the given place has
     *         nothing to do with proxies
     */
    public NavigationPlace navigationPlaceFor( final Place place ) {
        if ( !( place instanceof NavigationPlace ) ) {
            return null;
        }
        else {
            return (NavigationPlace)place;
        }
    }
}
